<template>
	<view class="star-box">
		<text class="cuIcon-favorfill text-yellow" v-for="yellow in yelloScore"></text>
		<text class="cuIcon-favorfill text-grey" v-for="grey in greyScore"></text>
		{{innerScore}}
	</view>
</template>

<script>
	export default {
		name:"star",
		data() {
			return {
				yelloScore:0,
				greyScore:5
			};
		},
		props:{
			innerScore:0,  //定义外部传入的分数
		},
		created(){
			var tempScore=0
			if(this.innerScore){
				tempScore=this.innerScore
			}
			this.yelloScore=parseInt(tempScore/2)
			this.greyScore=5-this.yelloScore
		}
	}
</script>

<style>
	.star-box>text:nth-of-type(5){
		padding-right: 10rpx;
	}
		
</style>
